package 单例模式.懒汉式;

public class Instance {
    private static Instance instance;
    private Instance (){
        System.out.println("懒汉式单例模式被创建了");
    }
    public synchronized static Instance getInstance(){
        if (instance==null){
            instance = new Instance();
        }
        return instance;
    }
}
